package com.zking.frame.czp;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.Cursor;
import java.awt.Font;
import java.awt.Toolkit;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.SwingConstants;
import javax.swing.WindowConstants;

import com.zking.frame.lsx.MainSwing;

public class Register_Jf extends JFrame {

	private static final long serialVersionUID = 1L;
	private JLabel labelUser, labelPassWd; // 密码
	private JLabel center_northpic, center_liftpic, southpic_lift, southpic_rightpic, center_rightpic, cancel, define; // 图片
	private JPasswordField passWdField, registerpassWdField; // 密码框 密码输入
	private JComboBox<String> userBox;

	private JPanel registerJPanel; // 登录帐号

	public Register_Jf() {
		Container c = getContentPane();
		c.setLayout(new BorderLayout());

//上部图片
		Icon icon1 = new ImageIcon(getClass().getResource("中部上界面图.png"));
		// 添加JLabel 放置图片
		JLabel center_northpic = new JLabel(icon1);
		// 设置label的位置、大小，label大小为图片的大小
		center_northpic.setBounds(0, 0, 495, 115);
		c.add(center_northpic);
//左部图片
		Icon icon2 = new ImageIcon(getClass().getResource("左部图片.png"));
		JLabel center_liftpic = new JLabel(icon2);
		center_liftpic.setBounds(0, 115, 254, 71);
		c.add(center_liftpic);
//南部左
		Icon icon3 = new ImageIcon(getClass().getResource("南左.png"));
		JLabel southpic_lift = new JLabel(icon3);
		southpic_lift.setBounds(0, 186, 199, 66);
		c.add(southpic_lift);
//右部图片
		Icon icon4 = new ImageIcon(getClass().getResource("右部图片.png"));
		JLabel rightpic = new JLabel(icon4);
		rightpic.setBounds(395, 115, 109, 99);
		c.add(rightpic);
//南右边
		Icon icon5 = new ImageIcon(getClass().getResource("南右.png"));
		JLabel southpic_rightpic = new JLabel(icon5);
		southpic_rightpic.setBounds(199, 214, 290, 37);
		c.add(southpic_rightpic);

//用户名
		userBox = new JComboBox<String>();
		userBox.addItem("管理员");
		userBox.setBounds(255, 115, 139, 29);
		c.add(userBox);

//密码

		passWdField = new JPasswordField(10);
		passWdField.setBounds(255, 150, 139, 29);
		c.add(passWdField);
//登录 
		registerJPanel = new JPanel();
		registerJPanel.setLayout(null);
		define = new JLabel("确定");
		define.setBounds(199, 185, 89, 26);
		define.setFont(new Font("微软雅黑", Font.PLAIN, 10));
		define.setOpaque(true);
		define.setBackground(Color.GRAY);
		define.setForeground(Color.WHITE);

		define.setHorizontalAlignment(SwingConstants.CENTER);
		define.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				new MainSwing();
				dispose();
			}

			@Override
			public void mouseEntered(MouseEvent e) {
				// System.out.println("鼠标进入，设置小手状态");
				setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
			}

			@Override
			public void mouseExited(MouseEvent e) {
				// System.out.println("鼠标离开，取消小手状态");
				setCursor(Cursor.getDefaultCursor());
			}
		});
		cancel = new JLabel("取消");
		cancel.setBounds(306, 185, 89, 26);
		cancel.setFont(new Font("微软雅黑", Font.PLAIN, 10));
		cancel.setOpaque(true);
		cancel.setBackground(Color.GRAY);
		cancel.setForeground(Color.WHITE);

		cancel.setHorizontalAlignment(SwingConstants.CENTER);
		cancel.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				dispose();
			}

			@Override
			public void mouseEntered(MouseEvent e) {
				// System.out.println("鼠标进入，设置小手状态");
				setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
			}

			@Override
			public void mouseExited(MouseEvent e) {
				// System.out.println("鼠标离开，取消小手状态");
				setCursor(Cursor.getDefaultCursor());
			}
		});
		registerJPanel.add(cancel);
		registerJPanel.add(define);
		c.add(registerJPanel);

		setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
		setSize(495, 283);
		setLocationRelativeTo(null);
		setTitle("正在登录.....");
		setIconImage(Toolkit.getDefaultToolkit().createImage(Register_Jf.class.getResource("登录左上角图标.png")));
		setResizable(false);
		setVisible(true);

	}
//
//	protected Image setImage(String string) {
//		// TODO Auto-generated method stub
//		return null;
//	}

	public static void main(String[] args) {
		new Register_Jf();

	}
}
